package br.com.trabalho.util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

/**
 *
 * @author cristian 
 */
public class HibernateConfiguracao {

    AnnotationConfiguration configuration = new AnnotationConfiguration();

    public HibernateConfiguracao() {
        configuration.configure("br/com/trabalho/util/hibernate.cfg.xml");
    }

    public Session openSession() {
        SessionFactory factory = configuration.buildSessionFactory();
        Session session = factory.openSession();
        return session;
    }
}
